home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cug236.zip / CB.DOC < prev    next >
Text File  |  1980-01-02  |  2KB  |  94 lines

  1. /*
  2.     HEADER:        CUG000.00;
  3.     TITLE:        C Source Formatter Manual Page;
  4.     DATE:        04/04/1987;
  5.     VERSION:    2.1;
  6.     FILENAME:    CB.DOC;
  7.     SEE-ALSO:    CB.C;
  8.     AUTHORS:    W. C. Colley III, J. W. Kindschi Jr.;
  9. */
  10.  
  11.          "C" Source Formatter   'Pretty Printer'
  12.  
  13.  
  14. DESCRIPTION:
  15.  
  16.      This program takes as input a "C" source  program    file  and 
  17.      formats  it with the proper indents for each statement.  The 
  18.      formatted     output      is placed in a specified  file,  or  by 
  19.      default, to the standard output.
  20.  
  21. INVOCATION:
  22.  
  23.      CB inputfile { outputfile }
  24.  
  25.      inputfile        Input  "C" source program.     This file should 
  26.             be    a file that has compiled error    free,  as 
  27.             the formatter is not smart enough to pick  up 
  28.             syntax errors.
  29.  
  30.      outputfile        This  is the formatted output file.      If this
  31.             argument  is  omitted,  the formatted  output
  32.             goes to the standard output stream.
  33.  
  34. HELP:
  35.  
  36.      Typing CB with no file name displays a short help reminder.
  37.  
  38. EXAMPLE:
  39.  
  40.      Run CB on file test, send the output to stdout:
  41.  
  42.       CB TEST
  43.  
  44.  
  45. *** <Contents of TEST before run.> ***
  46.  
  47. #include "stdio.h"
  48. double ran()
  49. /*        Generate a random number between 0.0 and 1.0    */
  50. {
  51. double r;
  52. static unsigned int seed = 0;
  53. struct regval { 
  54. int ax,bx,cx,dx,si,di,ds,es; 
  55. };
  56. struct regval regs;
  57.  
  58. if (seed==0) {
  59. regs.ax = 0x2C00;        /* Set up the function */
  60. sysint(0x21,®s,®s);
  61. seed = regs.dx;
  62. }
  63. r = seed / 65536.;
  64. seed = (25173 * seed + 13849) % 65536; 
  65. return(r);
  66. }
  67.  
  68.  
  69. *** <As seen on stdout after the run.> ***
  70.  
  71. #include "stdio.h"
  72. double ran()
  73. /*        Generate a random number between 0.0 and 1.0    */
  74. {
  75.     double r;
  76.     static unsigned int seed = 0;
  77.     struct regval { 
  78.         int ax,bx,cx,dx,si,di,ds,es; 
  79.     };
  80.     struct regval regs;
  81.  
  82.     if (seed==0) {
  83.         regs.ax = 0x2C00;         /* Set up the function */
  84.         sysint(0x21,®s,®s);
  85.         seed = regs.dx;
  86.     }
  87.     r = seed / 65536.;
  88.     seed = (25173 * seed + 13849) % 65536;
  89. }
  90. file name displays a short help reminder.
  91.  
  92. EXAMPLE:
  93.  
  94.      Run CB